<template>
  <div>
    <discoverm></discoverm>
    <lunbotu></lunbotu>
    <Recomend
      :recommends="recommends"
      :topalbum="topalbum"
      :homeartist="homeartist"
      @sendUrl="sendUrl"
    ></Recomend>
   
    
  </div>
</template>

<script>
import discoverm from "@/views/discoverM/discoverM.vue";
import { getdiscovermMultidata } from "@/network/discover.js";
import { gettopalbum } from "@/network/discover.js";
import { getartist } from "@/network/discover.js";
import lunbotu from "@/components/content/lunbotu/lunbotu.vue";
import Lunbotu from "../../lunbotu/lunbotu.vue";
import Recomend from "@/components/content/recommend/Recommend.vue";
import axios from "axios";

export default {
  name: "discover",
  components: {
    discoverm,
    lunbotu,
    Recomend,
  },
  data() {
    return {
      recommends: [],
      topalbum: [],
      homeartist: [],
      musicUrl: "",
      songid: "1234",

    };
  },
  created() {
    getdiscovermMultidata().then((res) => {
      for (let i = 0; i <= 7; i++) {
        //  this.recommends[i]=res.result[i]
        this.recommends.push(res.result[i]);
      }
    }),
      gettopalbum().then((res) => {
        for (var k = 0; k <= 4; k++) {
          //  this.topalbum[k]=res.monthData[k]}
          this.topalbum.push(res.monthData[k]);
        }
      }),
      getartist().then((res) => {
        for (var b = 14; b <= 19; b++) {
          this.homeartist.push(res.artists[b]);
        }
      });
    axios({
      url: "http://localhost:3000/song/url",
      method: "get",
      params: {
        id: this.songid, 
      },
    }).then((res) => {
      console.log(res);
      //   this.musicUrl=res.;
    });
  },
  methods: {
    sendUrl(data) {
      this.songid = data;
    }
  },
};
</script>
<style>

</style>
     
